#include "start.h"
#include "ui_start.h"

#include <QToolButton>
#include <QVector>

Start::Start(QWidget *parent) :
    QWidget(parent),
    ui(new Ui::Start)
{
    this->resize(300,600);
    this->setWindowIcon(QIcon(":/imgs/img/QQ.png"));
    this->setWindowTitle("QQ 2023");
    ui->listWidget->addItem("user_1");
    QVector<QString>nameList;
    nameList<<"用户1"<<"用户2"<<"用户3"<<"用户4"<<"用户5";
    for(int i=0;i<nameList.size();i++)
    {
        QToolButton *btn=new QToolButton(this);
        btn->setText(nameList[i]);
        btn->setIcon(QPixmap(QString(":/imgs/img/user_%1.png").arg(i)));
        QPixmap pixmap((QString(":/imgs/img/user_%1.png").arg(i)));
        //设置图片大小
        pixmap.scaled(QSize(100,100),Qt::KeepAspectRatio);
        //设置按钮透明样式
        btn->setAutoRaise(true);
        //查看其它控件是否具有相同的此属性
        btn->setToolButtonStyle(Qt::ToolButtonTextBesideIcon);        
    }

}
Start::~Start()
{
    delete ui;
}
